<?php
namespace Admin\Controller;
use Think\Controller;
class RuleController extends CommonController {
    public function lists(){

        $list=D('rule')->relation(true)->select();
        $this->assign('list',$list);
        $this->display();
    }
    public function add(){
        if(IS_POST){
             $result=D('rule')->add(I('post.'));
             if($result){
                $this->success('新增成功', 'lists');die;
             } else {    //错误页面的默认跳转页面是返回前一页，通常不需要设置
                $this->error('新增失败');}die;
        }
        $this->display();
    }
}